home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / AppleShare API / UGLibrary / UGLibrary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  4.3 KB  |  202 lines  |  [TEXT/MPS ]

  1. /*
  2. Created: Thursday, May 7, 1992 at 10:20 PM
  3.     UGLibrary.h
  4.     C Interface to UGLibrary.o
  5.     The library to manipulate the Users & Groups Data File
  6.  
  7.         Copyright Apple Computer, Inc. 1991-1992
  8.         All rights reserved
  9.     
  10.     4/10/95        JML        Added alignment pragmas and #includes for additional headers
  11.  
  12. */
  13.  
  14. #ifndef __TYPES__
  15. #include <Types.h>
  16. #endif
  17.  
  18. #ifndef __OSUTILS__
  19. #include <OSUtils.h>
  20. #endif
  21.  
  22. #if GENERATINGPOWERPC
  23. #pragma options align=mac68k
  24. #endif
  25.  
  26. typedef unsigned char Str199[200];
  27. typedef    unsigned char Str8[9];
  28.  
  29. enum {
  30.     /* ugUserFlags for UGNewUser, UGGetUserInfo, and UGSetUserInfo */
  31.     IACEnabled = 1,
  32.     LoginEnabled = 0x100,
  33.     SuperUser = 0x200,
  34.     NoChangePwd = 0x400,
  35.     GetNewPwd = 0x1000
  36. };
  37.  
  38. enum {
  39.     /* ugSrvrFlags[0] for UGGetULInfo and UGSetULInfo */
  40.     Apple2 = 1,
  41.     NoGuests = 2,
  42.     IACGuestEnabled = 16,
  43.     IACGlobalEnabled = 32,
  44.     /* ugSrvrFlags[1] for UGGetULInfo and UGSetULInfo */
  45.     DontSavePwd = 1
  46. };
  47.  
  48. enum {
  49.     /* ugChngFlags codes for UGSetUserInfo */
  50.     ChngUserPasswd = 1,
  51.     ChngUserFlags = 2,
  52.     ChngUAll = 3
  53. };
  54.  
  55. enum {
  56.     /* ugChngFlags codes for UGSetULInfo */
  57.     ChngSrvrFlags = 1,
  58.     ChngAdmnKey = 2,
  59.     ChngMinPwdLen = 4,
  60.     ChngMaxBadLogins = 8,
  61.     ChngPwdExpDate = 16,
  62.     ChngSrvrVersion = 32,
  63.     ChngULAll = 63
  64. };
  65.  
  66. enum {
  67.     /* server version as returned by UGGetULInfo */
  68.     Sys7SrvrVer = 3,
  69.     AS3SrvrVer = 4
  70. };
  71.  
  72. /* These are the Param Blocks for the interface calls: */
  73.  
  74. #define UGPBHeader \
  75.     QElemPtr        qLink;\
  76.     short            qType;\
  77.     short            ugTrap;\
  78.     Ptr                ugCmdAddr;\
  79.     ProcPtr            ugCompletion;\
  80.     OSErr            ugResult;\
  81.     StringPtr         ugNamePtr;\
  82.     short             ugVRefNum;\
  83.     short             ugRefNum;\
  84.     long             ugDirID;\
  85.     long             ugAccessID;\
  86.     unsigned long     ugUserID;\
  87.     unsigned long     ugGroupID; 
  88.     
  89. /* Use UGFilePB for UGOpenFile, UGCloseFile and UGCreateFile */
  90. struct UGFilePB {
  91.     UGPBHeader
  92.     StringPtr        ugAdminKey;
  93. };
  94.  
  95. #ifndef __cplusplus
  96. typedef struct UGFilePB UGFilePB;
  97. #endif
  98.  
  99.  
  100. /* Use UGUserPB for UGNewUser, UGDeleteUser, UGRenameUser, UGGetUserInfo, */
  101. /* UGSetUserInfo, and UGAuthenticateUser */
  102. struct UGUserPB {
  103.     UGPBHeader
  104.     short            ugPosOffset;
  105.     StringPtr        ugMisc;
  106.     short            ugChngFlags;
  107.     StringPtr        ugPassword;
  108.     long            ugUserFlags;
  109.     short            ugNumBadLogins;
  110.     long            ugPwdDate;
  111.     short            ugNumGroups;
  112.     long            ugGroups[42];
  113. };
  114.  
  115. #ifndef __cplusplus
  116. typedef struct UGUserPB UGUserPB;
  117. #endif
  118.  
  119.  
  120. /* Use UGGroupPB for UGNewGroup, UGDeleteGroup, UGRenameGroup, UGGetGroupInfo, */
  121. /* UGAssignUserToGroup, and UGDeleteUserFromGroup */
  122. struct UGGroupPB {
  123.     UGPBHeader
  124.     short            ugPosOffset;
  125.     StringPtr        ugMisc;
  126.     Boolean            ugPrimaryFlag;
  127. };
  128.  
  129. #ifndef __cplusplus
  130. typedef struct UGGroupPB UGGroupPB;
  131. #endif
  132.  
  133.  
  134. /* Use UGServerPB for UGGetULInfo and UGSetULInfo */
  135. struct UGServerPB {
  136.     UGPBHeader
  137.     StringPtr        ugAdminKey;
  138.     short            ugSrvrVersion;
  139.     short            ugChngFlags;
  140.     long            ugSrvrFlags[2];
  141.     Byte            ugMinPwdLen;
  142.     Byte            filler1;
  143.     short            ugMaxBadLogins;
  144.     long            ugPwdExpDate;
  145. };    
  146.  
  147. #ifndef __cplusplus
  148. typedef struct UGServerPB UGServerPB;
  149. #endif
  150.  
  151.  
  152. union    UGParamBlockRec {
  153.     UGFilePB        ugFilePB;
  154.     UGUserPB        ugUserPB;
  155.     UGGroupPB        ugGroupPB;
  156.     UGServerPB        ugServerPB;
  157. };
  158.  
  159. #ifndef __cplusplus
  160. typedef union UGParamBlockRec UGParamBlockRec;
  161. #endif
  162.  
  163. typedef UGParamBlockRec *UserGroupPBPtr;
  164.  
  165.  
  166. /* Declaration of functions */
  167.  
  168. #ifdef __cplusplus
  169. extern "C" {
  170. #endif
  171.  
  172. pascal OSErr    UGOpenFile(UserGroupPBPtr thePB, Boolean async);
  173. pascal OSErr    UGCloseFile(UserGroupPBPtr thePB, Boolean async);
  174. pascal OSErr    UGCreateFile(UserGroupPBPtr thePB, Boolean async);
  175.  
  176. pascal OSErr    UGNewUser(UserGroupPBPtr thePB, Boolean async);
  177. pascal OSErr    UGDeleteUser(UserGroupPBPtr thePB, Boolean async);
  178. pascal OSErr    UGRenameUser(UserGroupPBPtr thePB, Boolean async);
  179. pascal OSErr    UGGetUserInfo(UserGroupPBPtr thePB, Boolean async);
  180. pascal OSErr    UGSetUserInfo(UserGroupPBPtr thePB, Boolean async);
  181. pascal OSErr    UGAuthenticateUser(UserGroupPBPtr thePB, Boolean async);
  182.  
  183. pascal OSErr    UGNewGroup(UserGroupPBPtr thePB, Boolean async);
  184. pascal OSErr    UGDeleteGroup(UserGroupPBPtr thePB, Boolean async);
  185. pascal OSErr    UGRenameGroup(UserGroupPBPtr thePB, Boolean async);
  186. pascal OSErr    UGGetGroupInfo(UserGroupPBPtr thePB, Boolean async);
  187.  
  188. pascal OSErr    UGAssignUserToGroup(UserGroupPBPtr thePB, Boolean async);
  189. pascal OSErr    UGDeleteUserFromGroup(UserGroupPBPtr thePB, Boolean async);
  190.  
  191. pascal OSErr    UGGetULInfo(UserGroupPBPtr thePB, Boolean async);
  192. pascal OSErr    UGSetULInfo(UserGroupPBPtr thePB, Boolean async);
  193.  
  194.  
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198.  
  199. #if GENERATINGPOWERPC
  200. #pragma options align=reset
  201. #endif
  202.